package com.esint.spring_cloud_leaning.product.service.impl;

import com.esint.spring_cloud_leaning.product.dao.ProductDao;
import com.esint.spring_cloud_leaning.product.entity.Product;
import com.esint.spring_cloud_leaning.product.service.ProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @description: 类
 * @author: 谷明
 * @createDate: 2021/8/7 21:47
 */
@Service
public class ProductServiceImpl implements ProductService {
    @Autowired
    private ProductDao productDao;

    @Override
    public Product findById(Long id) {
        return productDao.findById(id).get();
    }

    @Override
    public void save(Product product) {
        productDao.save(product);
    }

    @Override
    public void update(Product product) {
        productDao.save(product);
    }

    @Override
    public void delete(Long id) {
        productDao.deleteById(id);
    }
}
